package com.assets.room.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import com.assets.room.entity.User;

import java.util.List;

@Dao
public interface UserDao {

    @Insert
    void insertUser(User user);

    @Query("SELECT * FROM sys_user")
    List<User> getAllData();

    @Query("SELECT * FROM sys_user WHERE user_id = :user_id")
    User getUserById(String user_id);

    @Query("SELECT name FROM sys_user WHERE user_id = :user_id")
    String getNameByIds(String user_id);

    @Insert
    void insertUser(List<User> user);

    @Query("DELETE FROM sys_user")
    void deleteAllData();

    @Query("SELECT name from sys_user WHERE create_user = :create_user")
    String getNameById(String create_user);

//    @Query("SELECT name from sys_user WHERE user_id = :user_id")
//    String getNameById(String user_id);

}
